﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;
//using Castle.Core;
//using Castle.MicroKernel.Registration;
////using Inmobiliaria.Infrastructure.Aspects;
//using Inmobiliaria.Services.Core.Interfaces;
//using Inmobiliaria.UCControllers;
//using Inmobiliaria.UCControllers.NoSecurity;

namespace Inmobiliaria.Infrastructure.Configuration
{
    //public class UCControllersConfigurator : IConfigurator
    //{
    //    #region IConfigurator Members

    //    public void Configure(Castle.Windsor.IWindsorContainer container)
    //    {
    //        ////container.Register(Component.For<TransactionAspect>().ImplementedBy<TransactionAspect>());
    //        ////container.Register(Component.For<LogErrorAspect>().ImplementedBy<LogErrorAspect>());
    //        ////container.Register(Component.For<Sinalic.Infrastructure.Aspects.Security>().ImplementedBy<Sinalic.Infrastructure.Aspects.Security>());

    //        //var UCCControllersConfigString = ConfigurationManager.AppSettings["UCCControllersImplementationAssembly"];
    //        //if (string.IsNullOrEmpty(UCCControllersConfigString))
    //        //    throw new ApplicationException(
    //        //        "No se configuro UCCControllersImplementationAssembly en archivo de configuración");
    //        //var assembly = Assembly.Load(UCCControllersConfigString);
    //        //if (assembly == null)
    //        //    throw new ApplicationException(string.Format(
    //        //                                       "no se pudo cargar el ensamblado {0}. definido en UCCControllersImplementationAssembly en archivo de configuración.",
    //        //                                       UCCControllersConfigString));

    //        //foreach (Type IUC in typeof(IPersonaUC).Assembly.GetTypes().Where<Type>(t => t.Namespace == typeof(IPersonaUC).Namespace && t.IsInterface))
    //        //{
    //        //    foreach (var UCImplementation in assembly.GetTypes())
    //        //    {
    //        //        if (IUC.IsAssignableFrom(UCImplementation))
    //        //            container.Register(Component.For(IUC).ImplementedBy(UCImplementation).LifeStyle.Transient.Interceptors(InterceptorReference.ForType<LogErrorAspect>()).Anywhere.Interceptors(InterceptorReference.ForType<TransactionAspect>()).Anywhere.Interceptors(InterceptorReference.ForType<Sinalic.Infrastructure.Aspects.Security>()).Anywhere);
    //        //    }

    //        }

    //    }

    //    #endregion
    //}
}
